package com.example.demo.controller;

import com.example.demo.ao.DataAnalyseAo;
import com.example.demo.model.DataAnylyseDao;
import com.example.demo.service.DataAnalyseService;
import com.example.demo.vo.DataAnalyseVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/DataAnalyseController")
@Slf4j
public class DataAnalyseController {

    @Autowired
    private DataAnalyseService dataAnalyseService;

    @PostMapping("/getDataAnalyseInfo")
    public Map<String, List<DataAnalyseVo>> getDataAnalyseInfo(@RequestBody DataAnalyseAo dataAnalyseAo) {
        Map<String, List<DataAnalyseVo>> dataAnylyseDao = dataAnalyseService.getDataAnalyseInfo(dataAnalyseAo);
        return dataAnylyseDao;
    }

    @PostMapping("/update/code")
    public int updateDataAnalyseInfo(@RequestBody List<DataAnalyseAo> dataAnalyseAo) {
        return dataAnalyseService.getDataAnalyseCount(dataAnalyseAo);
    }


    @PostMapping("/getInfo")
    public List<DataAnalyseVo> getInfo(@RequestBody List<DataAnalyseAo> dataAnalyseAo) {
        return dataAnalyseService.getInfo(dataAnalyseAo);
    }

    @PostMapping("/updateCode")
    public int updateCode(@RequestBody List<DataAnalyseAo> dataAnalyseAo) {
        return dataAnalyseService.updateCode(dataAnalyseAo);
    }


    @PostMapping("/getDataAnalyseTotal")
    public List<DataAnalyseVo> getDataAnalyseTotal(@RequestBody DataAnalyseAo dataAnalyseAo) {
        return dataAnalyseService.getDataAnalyseTotal(dataAnalyseAo);
    }
}
